package com.ssy.lingxi.product.entity.channelCommodity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ssy.lingxi.product.entity.customer.CustomerAttribute;
import com.ssy.lingxi.product.entity.customer.CustomerAttributeValue;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 商品实体类
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/28
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "product_channel_commodity_attribute")
public class ChannelCommodityAttribute implements Serializable {
    private static final long serialVersionUID = -817133529263489678L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="channel_commodity_attribute_seq")
    @SequenceGenerator(sequenceName="product_channel_commodity_attribute_seq", name="channel_commodity_attribute_seq",allocationSize = 1)
    private Long id;

    /**
     * 渠道商品属性
     */
    @JsonIgnore
    @ManyToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="channelCommodityUnitPricePicId",referencedColumnName = "id")
    private ChannelCommodityUnitPricePic channelCommodityUnitPricePic;

    /**
     * 会员属性
     */
    @OneToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="customerAttributeId",referencedColumnName = "id")
    private CustomerAttribute customerAttribute;

    /**
     * 会员属性值
     */
    @OneToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="customerAttributeValueId",referencedColumnName = "id")
    private CustomerAttributeValue customerAttributeValue;

}
